<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once './application/views/sys_admin/common/user_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
	<div class="admin_right_title"><strong>用户管理</strong> >> VIP审核</div>
		<div class="admin_right_con" style="width: 98%">
			<table border="0" cellspacing="1" cellpadding="0" bgcolor="#f0f0f0" width="100%">
			  <tr style="color:#636363;">
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>ID</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>用户名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>状态</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>审核备注</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>申请时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>
			  <?php foreach($list as $info){?>
			  <tr>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['user_id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['username'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo isset($statusArr[$info['vip_status']]) ? $statusArr[$info['vip_status']] : $statusArr['2']; ?> </td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['vip_verify_remark'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('Y-m-d',$info['kefu_addtime']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:checkVipStatus(<?php echo $info['vip_status']==2?$info['user_id']:0; ?>);"><?php echo $info['vip_status']==2?'审核':'--'; ?></a></td>
			  </tr>
			  <?php }?>
			  <tr>
			  	<td colspan="12" align="right" bgcolor="#FFFFFF">
			  		<form action="" method="get">
			  			用户名：<input type="text" id="username" name="username" value="<?php echo $parms['username'];?>" />
			  			状态：<select name="vip_status">
			  			<?php foreach($statusArr as $k => $v) { ?>
			  			<option value="<?php echo $k; ?>" <?php if($parms['vip_status']==$k) echo "selected='selected'"; ?>><?php echo $k==0?'全部':$v; ?></option>
			  			<?php } ?>
			  			</select>
			  			<input type="submit"/>
			  		</form>
			  	</td>
			  </tr>
			  <tr>
			  	<td height="35" colspan="12" align="center" class="page" bgcolor="#FFFFFF"><?php echo $this->pagination->create_links();?></td>
			  </tr>
			</table>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<div id="dialog" title="系统提示" style="display:none;">
<div id="msg" style="text-align:center;color:red">&nbsp;</div>
<input type="hidden" name="user_id" id="user_id" />
状态：<input type="radio" name="vip_status" checked="checked" value="1"/>审核通过  <input type="radio" name="vip_status" value="0"/>审核不通过 <br />
备注：<textarea  id="vip_verify_remark" name="vip_verify_remark" style="width: 300px;height: 100px;">VIP审核通过</textarea><br />
<div style="text-align:center;">
<input type="button" value="关闭" onclick="$('#dialog').dialog('close');"/>
<input type="button" value="提交" onclick="changeVip();" />
</div>
</div>
<script>
function checkVipStatus(userid){
	if(userid>0){
		$( "#dialog" ).dialog({
			height:250,
			width:500,
			modal:true, //蒙层（弹出会影响页面大小）
			title:'VIP审核'
		});
		$( "#user_id" ).val(userid);
	}
}

function changeVip(){
	$.ajax({
			type: "POST",
			url: "/sys_admin/user/vip_status",
			data: "user_id="+$('#user_id').val()+"&vip_status="+$(':radio:checked').val()+"&vip_verify_remark="+$('#vip_verify_remark').val(),
			success: function(msg){
		        $( "#dialog" ).dialog();
				$("#msg").html(msg);
				setTimeout(function(){
					$("#msg").html("&nbsp;");
					if(msg=='操作成功'){
						location.reload();
					}
				},3000);
			},
			dataType: "text"
		});
}


</script>
</body>
</html>
